<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p>点击按钮检测 "fruits" 变量是否为一个数组。</p>

<button onclick="myFunction()">点我</button>

<p id="demo"></p>

<script>
    // function myFunction() {
    //     var fruits = ["Banana", "Orange", "Apple", "Mango"];
    //     var x = document.getElementById("demo");
    //     x.innerHTML = Array.isArray(fruits);
    //     var ps = document.getElementsByTagName('p');
    //     console.log(ps,'ps is array:',Array.isArray(ps))
    // }

    var numbers = [65, 44, 12, 4];

    function getSum(total, num) {
        console.log('total',total,'num',num)
        return total + num;
    }
    function myFunction(item) {
        document.getElementById("demo").innerHTML = numbers.reduce(hi);
    }

    function hi(x,y) {
        return x+y;

    }
</script>


</body>
</html>